﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Display;

namespace EAGL.Display.Rendering
{
    public class SimplePointRenderer: Renderer
    {
   
     #region =================== PROTECTED ====================


        protected Color color;
        protected esriSimpleMarkerStyle style;
        protected Color outlineColor;
        protected double outlineWidth;
        protected double size;
        protected double xOffset;
        protected double yOffset;

        protected override void createRenderer()
        {
            ISimpleMarkerSymbol msym = new SimpleMarkerSymbolClass();
            msym.Color = ColorManager.GetESRIColor(this.color);
            msym.Style = this.style;
            msym.Outline = true;
            msym.OutlineColor = ColorManager.GetESRIColor(this.outlineColor);
            msym.OutlineSize = this.outlineWidth;
            

            ISimpleRenderer r = new SimpleRendererClass();
            r.Symbol = msym as ISymbol;
            r.Label = this.label;
            r.Description = description;
            this.renderer = r as IFeatureRenderer;
        }



     #endregion

     #region =================== PUBLIC  ======================

        public SimplePointRenderer(string Label, string Description)
        {
            this.label = Label;
            this.description = Description;
            
            // assign default values
            this.color = Color.Beige;
            this.style = esriSimpleMarkerStyle.esriSMSCircle;
            this.outlineColor = Color.Black;
            this.outlineWidth = 1;

            this.size = 3;
            this.xOffset = 0;
            this.yOffset = 0;
        }

        public SimplePointRenderer(string Label)
            : this(Label, "") { }

        public SimplePointRenderer()
            : this("") { }


        public Color Color
        {
            get { return this.color; }
            set { this.color = value; }
        }

        public esriSimpleMarkerStyle Style
        {
            get { return this.style; }
            set { this.style = value; }
        }

        public Color OutlineColor
        {
            get { return this.outlineColor; }
            set { this.outlineColor = value; }
        }

        public double OutlineWidth
        {
            get { return this.outlineWidth; }
            set { this.outlineWidth = value; }
        }

        public double Size
        {
            get { return this.size; }
            set { this.size = value; }
        }

        public double XOffSet
        {
            get { return this.xOffset; }
            set { this.xOffset = value; }
        }

        public double YOffSet
        {
            get { return this.yOffset; }
            set { this.yOffset = value; }
        }

     #endregion

    }
}
